﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace B.S.DataBasic.Infrastructure.Implement
{
    public interface IBaseRepository<T> where T : class
    {
        /// <summary>
        /// 查询多条
        /// </summary>
        /// <returns></returns>
        IQueryable<T> GetAll();
        /// <summary>
        /// 查询单条
        /// </summary>
        /// <param name="except"></param>
        /// <returns></returns>
        Task<T> GetAsync(Expression<Func<T, bool>> expression);
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns>返回</returns>
        Task<int> AddAsync(T entity);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns>返回</returns>
        Task<int> UpdateAsync(T entity);
        int Update(T entity);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns>返回</returns>
        Task<int> DeleteAsync(T entity);

        T GetById(int id);


    }
}
